package com.md.tw.service;

import com.md.tw.entity.Student;
import com.md.tw.mapper.StudentMapper;
import lombok.Data;

import java.util.Collections;
import java.util.List;

@Data
public class StudentServiceImpl implements StudentService {

    private StudentMapper studentMapper;

    @Override
    public List<Student> getAllStudents() {
        return studentMapper.getAllStudents();
    }

    @Override
    public Student getStudentById(int id) {
        return studentMapper.getStudentById(id);
    }

    @Override
    public boolean deleteStudentById(int id) {
        return studentMapper.deleteStudent(id) > 0;
    }

    @Override
    public void insertStudent(Student student) {
        studentMapper.insertStudent(student);
    }

    @Override
    public void updateStudent(Student student) {
        studentMapper.updateStudent(student);
    }
}
